package rsj.api.bil;

import com.rlyy.aibase.utils.base.Box;
import com.rlyy.aibase.utils.base.MapNode;
import common.util.Assert;
import common.util.BoxUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import rsj.api.user.BaseLink;
import rsj.service.BilService;
@RestController
public class DoBilConfirm extends BaseLink {

    @Autowired
    private BilService bilService;

    /**
     * Bill_Id
     * @param in
     * @return
     */
    @RequestMapping(value = "rsj_operative_bilConfirm")
    public Box executeLink(Box in){
        MapNode data = in.getMapNode("data");
        MapNode user = in.getMapNode("$user");
        String userId = user.getValue("User_Id");
        Assert.isNotNull(data, "没有收到要新增的信息！");

        String id = bilService.confirm(data,userId);

        return BoxUtil.successBox(in, "账单确认成功！", "Bill_Id", id);
    }

}
